# $Id: COMMANDS.pm,v 1.1 2007/10/08 09:26:03 schweitz Exp $
#
# NAME
# COMMANDS
#
# AUTHOR
# Franck Giron
# 
# DESCRIPTION
# This package defines autoloadable commands

package COMMANDS;

#----------------------------------------------------------------------
# perl packages
#----------------------------------------------------------------------

use Exporter ();

@ISA = qw(Exporter);

# Command constructor

sub new{
  my $that = shift;
  my $class = ref($that) || $that;
  my $self = {};
  bless $self, $class;
  return $self;
}

# Autoload the methods

sub AUTOLOAD{
  my $list = shift;
  my $type = ref($list);
  my $name = $AUTOLOAD;

  $name =~ s/.*://;
  if (@_) {
    %params = @_;
    while ( ($k,$v) = each %params) {
      $list->{$name}{$k} = $v;
    }
  }
  return $list->{$name};
}

sub Display{
  my $list = shift;
  my $class = ref($list) || $list;

  foreach $c (sort keys %{$list}) {
    warn "-$c $list->{$c}{Usage}\n";
  }
}
1;
